package com.futurescale.sa.model.vo
{
	import flash.events.Event;

	/**
	 * A Draft is one of any number of revisions to the 
	 * text of a single Scene. The read-only text of Chapters, 
	 * Parts and Stories and Scenes are generated from the 
	 * current Draft of each Scene. This value object 
	 * represents a single Draft of a Scene.  
	 */
	[Bindable] 
	public class DraftVO extends ValueObject
	{
		/**
		 * The XML element name.
		 */
		public static const ELEMENT:String = "Draft";
		
		/**
		 * Construct a DraftVO.
		 */
		public function DraftVO( xml:XML=null )
		{
			super( ELEMENT, xml );
		}
		
		/**
		 * Is this the current Draft for the Scene?
		 */ 
		public function get isCurrent():Boolean
		{
			return (x.@isCurrent=="true");
		}
		public function set isCurrent(b:Boolean):void
		{
			x.@isCurrent = b;
		}
		
		// These accessors are not used for DraftVO. 
		// The only content of the xml element is text.
		override public function set name( n:String ):void {}
		override public function set description( d:String ):void {}
		
		/**
		 * The text of this Draft.
		 */
		public function get text():String
		{
			return xml.toString();
		}
		public function set text( t:String ):void
		{
			x.setChildren(t);
		}
		
		/**
		 * Get a clone of this Draft.
		 */
		public function clone():DraftVO
		{
			return new DraftVO( xml.copy() );
		}
	}
}